<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/xml/qxml.cpp -->
<head>
  <title>Qt 4.3: QXmlNamespaceSupport Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QXmlNamespaceSupport Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1>
<p>The QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support. <a href="#details">More...</a></p>
<pre> #include &lt;QXmlNamespaceSupport&gt;</pre><p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qxmlnamespacesupport-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qxmlnamespacesupport.html#QXmlNamespaceSupport">QXmlNamespaceSupport</a></b> ()</li>
<li><div class="fn"/><b><a href="qxmlnamespacesupport.html#dtor.QXmlNamespaceSupport">~QXmlNamespaceSupport</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#popContext">popContext</a></b> ()</li>
<li><div class="fn"/>QString <b><a href="qxmlnamespacesupport.html#prefix">prefix</a></b> ( const QString &amp; <i>uri</i> ) const</li>
<li><div class="fn"/>QStringList <b><a href="qxmlnamespacesupport.html#prefixes">prefixes</a></b> () const</li>
<li><div class="fn"/>QStringList <b><a href="qxmlnamespacesupport.html#prefixes-2">prefixes</a></b> ( const QString &amp; <i>uri</i> ) const</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#processName">processName</a></b> ( const QString &amp; <i>qname</i>, bool <i>isAttribute</i>, QString &amp; <i>nsuri</i>, QString &amp; <i>localname</i> ) const</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#pushContext">pushContext</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#reset">reset</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a></b> ( const QString &amp; <i>pre</i>, const QString &amp; <i>uri</i> )</li>
<li><div class="fn"/>void <b><a href="qxmlnamespacesupport.html#splitName">splitName</a></b> ( const QString &amp; <i>qname</i>, QString &amp; <i>prefix</i>, QString &amp; <i>localname</i> ) const</li>
<li><div class="fn"/>QString <b><a href="qxmlnamespacesupport.html#uri">uri</a></b> ( const QString &amp; <i>prefix</i> ) const</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.</p>
<p>You can set the prefix for the current namespace with <a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a>(), and get the list of current prefixes (or those for a given URI) with <a href="qxmlnamespacesupport.html#prefixes">prefixes</a>(). The namespace URI is available from <a href="qxmlnamespacesupport.html#uri">uri</a>(). Use <a href="qxmlnamespacesupport.html#pushContext">pushContext</a>() to start a new namespace context, and <a href="qxmlnamespacesupport.html#popContext">popContext</a>() to return to the previous namespace context. Use <a href="qxmlnamespacesupport.html#splitName">splitName</a>() or <a href="qxmlnamespacesupport.html#processName">processName</a>() to split a name into its prefix and local name.</p>
<p>See also <a href="qtxml.html#namespace-support-via-features">Namespace Support via Features</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QXmlNamespaceSupport"></a>QXmlNamespaceSupport::QXmlNamespaceSupport ()</h3>
<p>Constructs a <a href="qxmlnamespacesupport.html">QXmlNamespaceSupport</a>.</p>
<h3 class="fn"><a name="dtor.QXmlNamespaceSupport"></a>QXmlNamespaceSupport::~QXmlNamespaceSupport ()</h3>
<p>Destroys a <a href="qxmlnamespacesupport.html">QXmlNamespaceSupport</a>.</p>
<h3 class="fn"><a name="popContext"></a>void QXmlNamespaceSupport::popContext ()</h3>
<p>Reverts to the previous namespace context.</p>
<p>Normally, you should pop the context at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in force are restored.</p>
<p>See also <a href="qxmlnamespacesupport.html#pushContext">pushContext</a>().</p>
<h3 class="fn"><a name="prefix"></a><a href="qstring.html">QString</a> QXmlNamespaceSupport::prefix ( const <a href="qstring.html">QString</a> &amp; <i>uri</i> ) const</h3>
<p>Returns one of the prefixes mapped to the namespace URI <i>uri</i>.</p>
<p>If more than one prefix is currently mapped to the same URI, this function makes an arbitrary selection; if you want all of the prefixes, use <a href="qxmlnamespacesupport.html#prefixes">prefixes</a>() instead.</p>
<p>Note: to check for a default prefix, use the <a href="qxmlnamespacesupport.html#uri">uri</a>() function with an argument of &quot;&quot;.</p>
<p>See also <a href="qxmlnamespacesupport.html#setPrefix">setPrefix</a>().</p>
<h3 class="fn"><a name="prefixes"></a><a href="qstringlist.html">QStringList</a> QXmlNamespaceSupport::prefixes () const</h3>
<p>Returns a list of all the prefixes currently declared.</p>
<p>If there is a default prefix, this function does not return it in the list; check for the default prefix using <a href="qxmlnamespacesupport.html#uri">uri</a>() with an argument of &quot;&quot;.</p>
<h3 class="fn"><a name="prefixes-2"></a><a href="qstringlist.html">QStringList</a> QXmlNamespaceSupport::prefixes ( const <a href="qstring.html">QString</a> &amp; <i>uri</i> ) const</h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a list of all prefixes currently declared for the namespace URI <i>uri</i>.</p>
<p>The &quot;xml:&quot; prefix is included. If you only want one prefix that is mapped to the namespace URI, and you don't care which one you get, use the <a href="qxmlnamespacesupport.html#prefix">prefix</a>() function instead.</p>
<p>Note: The empty (default) prefix is never included in this list; to check for the presence of a default namespace, call <a href="qxmlnamespacesupport.html#uri">uri</a>() with &quot;&quot; as the argument.</p>
<h3 class="fn"><a name="processName"></a>void QXmlNamespaceSupport::processName ( const <a href="qstring.html">QString</a> &amp; <i>qname</i>, bool <i>isAttribute</i>, <a href="qstring.html">QString</a> &amp; <i>nsuri</i>, <a href="qstring.html">QString</a> &amp; <i>localname</i> ) const</h3>
<p>Processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared.</p>
<p><i>qname</i> is the raw XML 1.0 name to be processed. <i>isAttribute</i> is true if the name is an attribute name.</p>
<p>This function stores the namespace URI in <i>nsuri</i> (which will be set to an empty string if the raw name has an undeclared prefix), and stores the local name (without prefix) in <i>localname</i> (which will be set to an empty string if no namespace is in use).</p>
<p>Note that attribute names are processed differently than element names: an unprefixed element name gets the default namespace (if any), while an unprefixed attribute name does not.</p>
<h3 class="fn"><a name="pushContext"></a>void QXmlNamespaceSupport::pushContext ()</h3>
<p>Starts a new namespace context.</p>
<p>Normally, you should push a new context at the beginning of each XML element: the new context automatically inherits the declarations of its parent context, and it also keeps track of which declarations were made within this context.</p>
<p>See also <a href="qxmlnamespacesupport.html#popContext">popContext</a>().</p>
<h3 class="fn"><a name="reset"></a>void QXmlNamespaceSupport::reset ()</h3>
<p>Resets this namespace support object ready for reuse.</p>
<h3 class="fn"><a name="setPrefix"></a>void QXmlNamespaceSupport::setPrefix ( const <a href="qstring.html">QString</a> &amp; <i>pre</i>, const <a href="qstring.html">QString</a> &amp; <i>uri</i> )</h3>
<p>This function declares a prefix <i>pre</i> in the current namespace context to be the namespace URI <i>uri</i>. The prefix remains in force until this context is popped, unless it is shadowed in a descendant context.</p>
<p>Note that there is an asymmetry in this library. <a href="qxmlnamespacesupport.html#prefix">prefix</a>() does not return the default &quot;&quot; prefix, even if you have declared one; to check for a default prefix, you must look it up explicitly using <a href="qxmlnamespacesupport.html#uri">uri</a>(). This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.</p>
<p>See also <a href="qxmlnamespacesupport.html#prefix">prefix</a>().</p>
<h3 class="fn"><a name="splitName"></a>void QXmlNamespaceSupport::splitName ( const <a href="qstring.html">QString</a> &amp; <i>qname</i>, <a href="qstring.html">QString</a> &amp; <i>prefix</i>, <a href="qstring.html">QString</a> &amp; <i>localname</i> ) const</h3>
<p>Splits the name <i>qname</i> at the ':' and returns the prefix in <i>prefix</i> and the local name in <i>localname</i>.</p>
<p>See also <a href="qxmlnamespacesupport.html#processName">processName</a>().</p>
<h3 class="fn"><a name="uri"></a><a href="qstring.html">QString</a> QXmlNamespaceSupport::uri ( const <a href="qstring.html">QString</a> &amp; <i>prefix</i> ) const</h3>
<p>Looks up the prefix <i>prefix</i> in the current context and returns the currently-mapped namespace URI. Use the empty string (&quot;&quot;) for the default namespace.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
